package greate.project;

import lombok.extern.slf4j.Slf4j;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;

import java.util.Date;

/**
 * @author v_zhangshun01
 */
@Slf4j
public class App {

    public static void main(String[] args) throws Exception {

        // 创建默认上下文
        CamelContext context = new DefaultCamelContext();

        // 现开启想表达的是 ， camel 在开启后可以动态的新增和关闭路由。
        context.start();

        // 新增路由
        context.addRoutes(new HelloWorldRoute());

        // 关闭
        context.close();

    }

    static class HelloWorldRoute extends RouteBuilder {
        @Override
        public void configure() throws Exception {
            System.out.println("hello world.");
        }
    }

}
